<!-- el-table-column-filter组件 -->
<template>
  <el-table-column v-if="getVisible($attrs)" v-bind="$attrs">
    <template slot="header"><slot name="header"></slot></template>
    <template slot-scope="scope">
      <slot :row="scope.row" :$index="scope.$index" :column="scope.column"
        >{{ scope.row[$attrs.prop] }}
      </slot>
    </template>
  </el-table-column>
</template>

<script>
export default {
  name: "el-table-column-filter",
  inheritAttrs: false,
  data() {
    return {
      columnsArr: this.$parent.$attrs.columnsArr,
      key: false
    };
  },
  watch: {},

  methods: {
    getVisible(attrs) {
      // console.log(val.prop);
      for (let i = 0; i < this.columnsArr.length; i++) {
        if (this.columnsArr[i].prop === attrs.prop) {
          return this.columnsArr[i].visible;
        }
      }
    }
  }
};
</script>
<style scoped lang="scss"></style>
